package cn.js.sip.rat.system.service.impl;

import cn.js.sip.rat.system.entity.SysRoleEntity;
import cn.js.sip.rat.system.mapper.SysRoleMapper;
import cn.js.sip.rat.system.page.TableDataInfo;
import cn.js.sip.rat.system.service.SysRoleService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: cn.js.sip.rat.system.service.impl
 * @Description: TODO
 * @author: xuxiaoli
 * @Date: 2019-12-28   19:04
 */
@Service("sysRoleService")
public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleEntity> implements SysRoleService {
    @Resource
    private SysRoleMapper sysRoleMapper;

    @Override
    public SysRoleEntity findById(String id) {
        return sysRoleMapper.selectById(id);
    }

    @Override
    public List<SysRoleEntity> getRolesByUserId(String userId) {
        return sysRoleMapper.getRoleByUser(userId);
    }

    @Override
    public TableDataInfo query(SysRoleEntity entity) {
        Page page = new Page(1,10);
        Page mapsPage = sysRoleMapper.selectPage(page, null);
        return super.getDataTable(mapsPage);
    }

    @Override
    public List<SysRoleEntity> getAll() {
        return sysRoleMapper.selectList(null);
    }
}
